package cuiyt.datastructure.stack;


import cuiyt.datastructure.list.CyList;

/**
 * @author cyt
 * @create 2020-11-22 18:15
 */
public class CyStack<E> {
    private CyList<E> list = new CyList<>();

    public boolean isEmpty() {
        return list.isEmpty();
    }

    public int size() {
        return list.size();
    }

    public void push(E element) {
        list.add(element);
    }

    public E pop() {
        return list.remove(list.size() - 1);
    }

    public E top() {
        return list.get(list.size() - 1);
    }

    public E peek() {
        return list.get(list.size() - 1);
    }
}
